package day11_rellyGame;

import java.util.*;

public class Test {
    public static void main(String[] args) {
//        Attack[] player= new Player[10];
//        player[0]=new Player("p1",20,40,100);
//        player[1]=new Player("p2",10,60,200);
//        player[2]=new Player("p3",30,20,300);
//        player[3]=new Player("p4",30,20,500);
        List<Player> player = new ArrayList<>();
        player.add(new Player("p1",10,40,100));
        player.add(new Player("p2",20,30,100));
        player.add(new Player("p3",30,20,100));
        player.add(new Player("p4",40,10,100));

//        Attack[] weapon = new Weapon[10];
//        weapon[0]=new Weapon("弓箭",40,10,false);
//        weapon[1]=new Weapon("小刀",30,30,true);
//        weapon[2]=new Weapon("狙击枪",50,0,false);
//        weapon[3]=new Weapon("大剑",10,50,true);
        List<Weapon> weapon = new ArrayList<>();
        weapon.add(new Weapon("弓箭",40,10,false));
        weapon.add(new Weapon("小刀",30,30,true));
        weapon.add(new Weapon("狙击枪",50,0,false));
        weapon.add(new Weapon("大剑",10,50,true));
        ChooseAll chooses=new ChooseAll(player,weapon);
        Scanner sc = new Scanner(System.in);
        Boolean b=true;
        while (b){
            chooses.chooseP();
            chooses.chooseW();
            System.out.println("1.加入角色\n2.开始游戏");
            int i=sc.nextInt();
            if(i==1){
                b=true;
            }
            else {
                b=false;
            }
        }
        compute compute=new compute();
        compute.show();

        //Chooses(player,weapon,n)



    }
}
class ChooseAll{
      List<Player> players;
      List<Weapon> weapons;


    public ChooseAll(List<Player> players, List<Weapon> weapons) {
        this.players = players;
        this.weapons = weapons;
    }

    void showP(){
         for(int i=0;i<players.size();i++){
             System.out.println(players.get(i).name+"\t"+players.get(i).atk+"\t"+players.get(i).def+"\t"+players.get(i).HP);
         }
    }
    void showW(){
        for(int i=0;i<weapons.size();i++){
            System.out.println(weapons.get(i).name+"\t"+weapons.get(i).atk+"\t"+weapons.get(i).def+"\t"+weapons.get(i).close);
        }
    }
    void chooseP(){
        Scanner sc=new Scanner(System.in);
        showP();
        System.out.print("请选择你的角色：");
        int i=sc.nextInt()-1;
        compute compute=new compute(players.get(i));
        compute.all();
    }
    void chooseW(){
        Scanner sc=new Scanner(System.in);
        showW();
        System.out.print("请选择你的武器");
        int i=sc.nextInt()-1;
        compute compute=new compute(weapons.get(i));
        compute.all();
    }
}